package com.wteam.controller;


import com.wteam.PoJo.DTO.PageQuery;
import com.wteam.PoJo.DTO.UserLoginDTO;
import com.wteam.PoJo.VO.GoodsVO;
import com.wteam.PoJo.VO.ParamsVO;
import com.wteam.PoJo.VO.UserLoginVO;
import com.wteam.Service.IGoodsService;
import com.wteam.Service.IParamsService;
import com.wteam.until.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 商品表 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-07-16
 */
@RestController
@RequestMapping("/goods")
@Api(tags = "商品模块")
public class GoodsController {
    @Autowired
    private IGoodsService goodsService;

    @Autowired
    private IParamsService iParamsService;

    @ApiOperation(value = "查看现货商品（粗略）")
    @PostMapping("/selectgood")

    public Result<List<GoodsVO>> getgood(PageQuery pageQuery) {
        return  goodsService.selectgood(pageQuery);
    }

    @ApiOperation(value = "查看现货商品（详细）")
    @GetMapping("/selectgood/{goodid}")
    public Result<ParamsVO> getgooddetial(@ApiParam("商品id") @PathVariable Long goodid) {
        return  iParamsService.selectparams(goodid);
    }
    @ApiOperation(value ="根据id批量查现货商品（详细）")
    @GetMapping("/selectgoods")
    public Result<List<ParamsVO>> selectgoods(@RequestParam List<Long>ids) {
        return  iParamsService.selectgoods(ids);
    }

}
